package com.jams.goodox.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hangzhou.jin.customview.TailsTextView;
import com.jams.goodox.R;
import com.jams.goodox.activity.wallet.MineWalletActivity;
import com.jams.goodox.entity.RechargeRedPacket;

import java.util.List;

/**
 * Created by Jin on 2016/12/27.
 * Description 我的钱包充值送的 适配器
 */
public class MineWalletAdapter extends BaseQuickAdapter<RechargeRedPacket> {

	public MineWalletAdapter(List<RechargeRedPacket> list) {
		super(R.layout.mine_wallet_item, list);
	}

	@Override
	protected void convert(final BaseViewHolder baseViewHolder, final RechargeRedPacket bean) {

		final TailsTextView money = baseViewHolder.getView(R.id.money);
		final TailsTextView give = baseViewHolder.getView(R.id.give);

		money.setText(bean.getRechargeMoney());
		give.setText(bean.getRedPacketMoney());

		baseViewHolder.getView(R.id.layout).setBackground(mContext.getResources().getDrawable(R.drawable.bg_mine_wallet_item));

		baseViewHolder.getView(R.id.layout).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				baseViewHolder.getView(R.id.layout).setBackground(mContext.getResources().getDrawable(R.drawable.bg_mine_wallet_item_click));
				((MineWalletActivity) mContext).dialog(bean.getRechargeMoney());
			}
		});
	}
}
